<template>
  <view class="container">
    <view class="header">🚧 故障排行榜</view>

    <view
      class="fault-item"
      v-for="(item, index) in faultRankList"
      :key="index"
      :class="{ top1: index === 0 }"
    >
      <view class="rank">
        <text v-if="index === 0">🥇</text>
        <text v-else-if="index === 1">🥈</text>
        <text v-else-if="index === 2">🥉</text>
        <text v-else>{{ index + 1 }}</text>
      </view>
      <view class="info">
        <view class="name">{{ item.name }}</view>
        <view class="count">发生 {{ item.count }} 次</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      faultRankList: [
        {
          name: "1号楼-A梯",
          count: 12
        },
        {
          name: "行政楼-B梯",
          count: 9
        },
        {
          name: "2号宿舍楼-C梯",
          count: 7
        },
        {
          name: "地下车库-D梯",
          count: 5
        },
        {
          name: "教学楼-E梯",
          count: 3
        }
      ]
    };
  }
};
</script>

<style scoped>
.container {
  padding: 30rpx;
  background-color: #f5f5f5;
  min-height: 100vh;
}

.header {
  font-size: 40rpx;
  font-weight: bold;
  text-align: center;
  margin-bottom: 30rpx;
}

.fault-item {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border-radius: 16rpx;
  padding: 24rpx;
  margin-bottom: 20rpx;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}

.rank {
  font-size: 36rpx;
  width: 60rpx;
  text-align: center;
  color: #555;
}

.info {
  flex: 1;
  padding-left: 20rpx;
}

.name {
  font-size: 32rpx;
  color: #333;
  font-weight: 600;
}

.count {
  font-size: 26rpx;
  color: #999;
  margin-top: 10rpx;
}

.top1 {
  background-color: #fff9e6;
  border: 2rpx solid #ffd700;
}
</style>
